var t,
  a = require("../../res/www.a9a.cn.js"),
  o = getApp();
Page({
  data: { topbar: ["我的相册"], currentTab: 0 },
  onLoad: function (t) {
    var e = this;
    o.chklogin().then(function (t) {
      t || wx.navigateBack();
    }),
      o.get_openid().then(function (t) {
        e.setData({ color: o._ZEAI.color, rgbcolor: a.c16_rgb(o._ZEAI.color) }),
          e.getdata();
      });
  },
  upFn: function () {
    var e = this;
    wx.chooseMedia({
      count: 1,
      mediaType: ["image"],
      sizeType: ["compressed"],
      sourceType: ["album", "camera"],
      success: function (n) {
        wx.uploadFile({
          url: o.WWW + "/api/wxxcx/my_photo.php",
          filePath: n.tempFiles[0].tempFilePath,
          name: "pic",
          formData: { submitok: "up", openid: t.openid },
          success: function (t) {
            1 == (t = a.jsoneval(t.data)).flag
              ? e.getdata()
              : wx.showModal({
                  content: t.msg,
                  confirmColor: e.data.color,
                  confirmText: "朕知道了",
                  showCancel: !1,
                  success: function (t) {
                    wx.navigateBack();
                  },
                });
          },
        });
      },
    });
  },
  getdata: function () {
    var a = this;
    (t = wx.getStorageSync("COOK_U")),
      o.ajax({
        url: "my_photo.php",
        data: { submitok: "index", openid: t.openid },
        success: function (t) {
          1 == t.flag
            ? a.setData({ b_list: t.b_list, LIST: t.ARR })
            : wx.showToast({ title: t.msg, icon: "none", mask: !0 });
        },
      });
  },
  delFn: function (a) {
    var e = this;
    wx.showModal({
      title: "",
      content: "确定要删除么？",
      confirmColor: e.data.color,
      cancelText: "取消",
      confirmText: "确定",
      success: function (n) {
        if (n.confirm) {
          var c = a.currentTarget.dataset.id;
          o.ajax({
            url: "my_photo.php",
            data: { submitok: "del", id: c, openid: t.openid },
            success: function (t) {
              1 == t.flag
                ? e.getdata()
                : wx.showModal({
                    content: t.msg,
                    confirmColor: e.data.color,
                    confirmText: "朕知道了",
                    showCancel: !1,
                    success: function (t) {
                      wx.navigateBack();
                    },
                  });
            },
          });
        }
      },
    });
  },
  viewFn: function (t) {
    var o = t.currentTarget.dataset.path_b;
    a.empty(o) || wx.previewImage({ current: o, urls: this.data.b_list });
  },
  onShow: function () {},
});
